/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ez2find.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Owner
 */
@NamedQueries(value={@NamedQuery(name="listAllEvents", query="SELECT e FROM Event e"),
                     @NamedQuery(name="lastEventCode", query="SELECT MAX(e.code) FROM Event e")})

@Entity
public class Event extends Post implements Serializable{

    @Temporal(TemporalType.DATE)
    private Date startDate;
    private boolean onlyOneDate;
    @Temporal(TemporalType.DATE)
    private Date endDate;
    //Permissions
    private boolean othersContact;
    @ManyToOne()
    private CategoriaEvento eventCategorie;
    
    public boolean isOthersContact() {
        return othersContact;
    }

    public void setOthersContact(boolean othersContact) {
        this.othersContact = othersContact;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public boolean getOnlyOneDate() {
        return onlyOneDate;
    }

    public void setOnlyOneDate(boolean onlyOneDate) {
        this.onlyOneDate = onlyOneDate;
    }

    public CategoriaEvento getEventCategorie() {
        return eventCategorie;
    }

    public void setEventCategorie(CategoriaEvento eventCategorie) {
        this.eventCategorie = eventCategorie;
    }
    
}
